package com.yangyang.ralearn.message;

import java.util.List;

import org.apache.log4j.Logger;
import org.jboss.netty.channel.Channel;

import com.yangyang.ralearn.common.JEnvironment;
import com.yangyang.ralearn.common.entity.base.AbstractDomainPredicate;
import com.yangyang.ralearn.common.entity.base.BasePredicate;
import com.yangyang.ralearn.net.message.AbstractRespMessage;
import com.yangyang.ralearn.net.message.Message;
import com.yangyang.ralearn.net.message.MessageId;
import com.yangyang.ralearn.net.serialize.AutoSerializable;
import com.yangyang.ralearn.server.JSimulator;
import com.yangyang.ralearn.util.Object2String;

@Message(id = MessageId.RESP_CREATE_GROUP)
public class RespCreateGroupMessage extends AbstractRespMessage {

	@AutoSerializable(index = 1)
	private String environmentData = "";
	private JEnvironment environment2;

	@AutoSerializable(index = 2)
	private String goalData = "";
	private List<AbstractDomainPredicate> goalStates;

	@Override
	public void onGetServerMessage(int groupId, int simulatorId, Channel channel) {
		// TODO Auto-generated method stub
		environment2 = new Object2String<JEnvironment>()
				.string2Object(environmentData);
		Logger.getLogger(RespCreateGroupMessage.class).debug(
				"*********************");
		Logger.getLogger(RespCreateGroupMessage.class).debug(environment2);
		// Logger.getLogger(RespCreateGroupMessage.class).debug(data);
		Logger.getLogger(RespCreateGroupMessage.class).debug(
				"*********************");
		goalStates = new Object2String<List<AbstractDomainPredicate>>()
				.string2Object(goalData);
		Logger.getLogger(RespCreateGroupMessage.class).debug(
				"*********************");
		Logger.getLogger(RespCreateGroupMessage.class).debug(goalStates);
		// Logger.getLogger(RespCreateGroupMessage.class).debug(data);
		Logger.getLogger(RespCreateGroupMessage.class).debug(
				"*********************");
	}

	public JEnvironment getEnvironment() {
		return this.environment2;
	}

	public List<AbstractDomainPredicate> getGoalStates() {
		return this.goalStates;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	public void init(String environmentData, String goalData) {
		// TODO Auto-generated method stub
		this.environmentData = environmentData;
		this.goalData = goalData;
	}

}
